package com.shanling.shanlingcontroller.persenter

import android.content.Context
import com.shanling.shanlingcontroller.music.player.SongLoader
import com.shanling.shanlingcontroller.persenter.contract.MusicListContract
import com.shanling.shanlingcontroller.persenter.contract.PlayListDetailContract
import org.jetbrains.anko.doAsync
import org.jetbrains.anko.uiThread

/**
 * Created by ch1 on 2019/11/22.
 */
class MusicListPersenter constructor() : RxPresenter<MusicListContract.View>(), MusicListContract.Presenter {
    override fun loadSongs(context: Context,path: String) {
        mView?.showLoading()
        doAsync {
            val musicList = SongLoader.getSongListInFolder(context, path)
            uiThread {
                mView?.hideLoading()
                mView?.showSongs(musicList)
            }

        }
    }
}